


Calculates several properties of the field on a sphere surface at r=r0 for PWE
For PWE, we have: |m|=1; a,c even in m; b,d, odd in m.
The 4 Mie coefficients in stAabcdn1 must be the relevant ones
at r=r0.
Use r0=Inf to obtain far-field properties.
The fields Ecr, Ect, Esf given in the results are discussed in the
supplementary information.
Parameters:
- lambda: column vector [L x 1]
wavelengths in nm
- epsilon: scalar or column vector [L x 1]
epsilon of dielectric where field is evaluated
- stAbcdn1: structure with 4 fields, an1, bn1, cn1, dn1,
each a matrix [L x nNmax]
containing the Mie coefficients a_{n,1}, b_{n,1},
c_{n,1} and d_{n,1} used for the VSH expansions at r=r0.
- r0: scalar [1 x 1] non-zero
distance from origin (in nm)
r0 can be "Inf" to obtain far-field radiation profile
- nNbTheta: integer scalar
number of theta points used for computations
- sRegion: string
'outside', 'inside', 'scattering, or 'all' (default):
* if 'outside': the points should be in the outside region (outside the largest
sphere). The regular part of the field (coeffs a and b) is then known and not
computed from the plane wave incident field (faster).
* if 'scattering': the regular part of the field (coeffs a and
b) is set to zero (no a and b needed)
* if 'inside': the points should be in the inside region (containing the origin), then
the irregular part of the field is zero (no coeffs c and d needed).
* otherwise: all of a,b,c,d are used.
- stPinTaun: structure (optional)
with functions of theta pi_n and tau_n
if omitted, then the functions are computed from scrath
it is faster to pass this structure as argument if these
functions have already been calculated
Returns: structure stEsurf with fields
- stEsurf.theta: [1 x T] row vector with theta's
- stEsurf.r0: [1 x 1] r0 (in nm)
- stEsurf.lambda: [L x 1] lambda (in nm)
- stEsurf.Ecr: [L x T] wavelength-and-theta-dependent Ecr
- stEsurf.Ect: [L x T] wavelength-and-theta-dependent Ect
- stEsurf.Esf: [L x T] wavelength-and-theta-dependent Esf
- stEsurf.MLocParaAve: [L x 1] wavelength-dependent average MLocPara
- stEsurf.MLocPerpAve: [L x 1] wavelength-dependent average MLocPerp
- stEsurf.MLocAve: [L x 1] wavelength-dependent average MLoc
- stEsurf.F0E4Ave: [L x 1] wavelength-dependent average SERS EF F^0_{E4}
- stEsurf.F0E4PerpAve: [L x 1] wavelength-dependent average SERS EF
F^0_{E4} for perpendicular component
- stEsurf.F0E4ParaAve: [L x 1] wavelength-dependent average SERS EF
F^0_{E4} for parallel component
This file is part of the SPlaC v1.0 package (copyright 2008)
Check the README file for further information



0001 global noCheckSum; 0002 if (isempty(noCheckSum) || ~noCheckSum) 0003 disp 'PweEsurf: CheckSum ON' 0004 else 0005 disp 'PweEsurf: CheckSum OFF' 0006 end 0007 0008 if (nNbTheta<91) 0009 disp 'Warning in PweEsurf: nNbTheta must be large for averages to be meaningful' 0010 end 0011 0012 theta=linspace(0,pi,nNbTheta); % row [1 x T] 0013 0014 % get theta dependence if not provided 0015 if nargin < 7 0016 if isfield(stAbcdn1,'an1') 0017 nNmax=size(stAbcdn1.an1,2); 0018 else 0019 nNmax=size(stAbcdn1.cn1,2); 0020 end 0021 stPinTaun=PwePinTaun(nNmax,transpose(theta)); % fields are [T x nNmax] 0022 end 0023 0024 % calculate regular VSH expansion (coeffs a,b) 0025 if strcmpi(sRegion,'outside') 0026 % get regular field from known plane wave expression of incident field 0027 disp 'PweEsurf: Outside region: get regular field directly from PWE expression' 0028 stEAllPhiReg=PweEincThetaAllPhi(lambda,epsilon,r0,theta); 0029 else 0030 if strcmpi(sRegion,'scattering') 0031 disp 'PweEsurf: scattering only: regular VSH expansion is zero...' 0032 stEAllPhiReg.Ecr=0; 0033 stEAllPhiReg.Ect=0; 0034 stEAllPhiReg.Esf=0; 0035 else 0036 disp 'PweEsurf: Computing regular VSH expansions (coeffs a,b)...' 0037 stEAllPhiReg=PweEgenThetaAllPhi(lambda,epsilon,stAbcdn1.an1,stAbcdn1.bn1,r0,theta,'j',stPinTaun); 0038 end 0039 end 0040 if strcmpi(sRegion,'inside') 0041 disp 'PweEsurf: Inside: Irregular VSH expansions is zero...' 0042 stEAllPhiIrr.Ecr=0; 0043 stEAllPhiIrr.Ect=0; 0044 stEAllPhiIrr.Esf=0; 0045 else 0046 % calculate irregular VSH expansion (coeffs c,d) 0047 disp 'PweEsurf: Computing irregular VSH expansions (coeffs c,d)...' 0048 stEAllPhiIrr=PweEgenThetaAllPhi(lambda,epsilon,stAbcdn1.cn1,stAbcdn1.dn1,r0,theta,'h1',stPinTaun); 0049 end 0050 0051 disp 'PweEsurf: Compiling results and averages...' 0052 % Ecr, Ect, and Esf are [L x T] 0053 stEsurf.Ecr=GenCheckSum2Mat(stEAllPhiReg.Ecr,stEAllPhiIrr.Ecr,'Ecr','PweEsurf'); 0054 stEsurf.Ect=GenCheckSum2Mat(stEAllPhiReg.Ect,stEAllPhiIrr.Ect,'Ect','PweEsurf'); 0055 stEsurf.Esf=GenCheckSum2Mat(stEAllPhiReg.Esf,stEAllPhiIrr.Esf,'Esf','PweEsurf'); 0056 0057 stEsurf.theta=theta; 0058 stEsurf.r0=r0; 0059 stEsurf.lambda=lambda; 0060 0061 clear stEAllPhiReg stEAllPhiIrr; 0062 0063 % computes surface-averages 0064 stEsurf=PweEFaverages(stEsurf); 0065 0066 disp 'PweEsurf: done...' 0067 disp ' ' 0068 0069 0070